"use strict";
{
    //布尔类型
    //声明了一个布尔类型的变量
    let b;
    b = true;
    b = false;
    // b = 200; //  Type 'number' is not assignable to type 'boolean'
    let b2 = true;
    b2 = false;
    // b2 = 'abc'; // Type 'string' is not assignable to type 'boolean'
    //数字类型
    let n;
    n = 100; //十进制
    n = 0b1010; // 二进制
    n = 0o777; // 八进制
    n = 0xff; // 十六进制
    // n = 'abc';
    // n = '123'; // Type 'string' is not assignable to type 'number'.
    let n2 = 521;
    // console.log(n2);
    //字符串类型
    let s;
    s = "i love you";
    s = "i miss you";
    s = `i want you`;
    let s2 = "如果你是一匹千里马，那么请做自己的伯乐";
    console.log(s2);
    //字面量值类型 像常量
    let x = "love";
    let x2;
    x2 = true;
    let x3;
    x3 = null;
    //any 任意   不会对 any 类型的变量进行类型检测
    let a;
    a = 100;
    a = "abc";
    a = true;
    //void 类型
    let v;
    v = undefined;
    function fn() { }
    //object 类型
    let o;
    o = { a: 100, b: 200 };
    o = ["1", "2", "3"];
    o = function () { };
    //array 数组类型  [1,'a',true]
    let arr = ["zhangsan", "lisi", "wangwu"];
    arr.push("zhaosi");
    let arr2 = [1, 2, 3, 4];
    arr2.unshift(0);
    //元组
    let t = ["古天乐", 51];
    let stus = [
        ["王淼", 18],
        ["徐东", 18],
    ];
    console.log(stus);
    //枚举类型  defineProperty  create
    let Gender;
    (function (Gender) {
        Gender["female"] = "\u5973";
        Gender["male"] = "\u7537";
        Gender["secret"] = "\u4FDD\u5BC6";
    })(Gender || (Gender = {}));
    let obj = {
        name: "张三",
        age: 18,
        gender: Gender.male,
    };
    console.log(obj);
    //联合类型
    let key;
    key = 100;
    key = "axy";
    key = true;
    let key2;
    // key2 = 3;
    //类型断言
    let div = document.querySelector("#root");
    //方式一
    // (div as HTMLElement).style.background = '#aef';
    div.style.background = "#789";
    //方拾二
    // (<HTMLElement>div).style.background = "#999";
    //类型推断
    let xyz = 100;
    // xyz = 'abc';
    let abc;
    abc = 100;
    abc = "abc";
    abc = true;
    abc = ["1", "2"];
}
